<template>
  <div>
    <iframe ref="mainIframe" name="mainIframe" src="/404.html" style="background-size: 100%;height: 100vh;width: 100vw;margin: 0px;padding: 0px" height="100%" width="100%" scrolling="no"></iframe>
  </div>
</template>

<script>

export default {
  name: "notFound",
  data(){
    return{

    }
  },
  methods:{
    resizeInframe(){
      var iframe = this.$refs.mainIframe;
      var iframeWindow = iframe.contentWindow;
      //内容是否加载完
      if (iframeWindow.document.readyState == "complete")
      {
        var iframeWidth, iframeHeight;
        //获取Iframe的内容实际宽度
        iframeWidth = iframeWindow.document.documentElement.scrollWidth;
        //获取Iframe的内容实际高度
        iframeHeight = iframeWindow.document.documentElement.scrollHeight;
        //设置Iframe的宽度,注意不能用iframe.style.width
        iframe.width = iframeWidth;
        //设置Iframe的高度,注意不能用iframe.style.height
        iframe.height = iframeHeight;
      } else
      {
        //重新调用
       setTimeout(this.resizeInframe, 10);
      }
    }
  },
  mounted() {
   setTimeout(this.resizeIframe, 10);

  }
}
</script>

<style scoped>

</style>